package com.hhf.feiojquestionservice.controller.inner;

import com.hhf.feiojapiservice.client.QuestionFeignClient;
import com.hhf.feiojcommonservice.model.entity.Question;
import com.hhf.feiojcommonservice.model.entity.QuestionSubmit;
import com.hhf.feiojquestionservice.service.QuestionService;
import com.hhf.feiojquestionservice.service.QuestionSubmitService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author hhf
 * @Date 2024/11/3
 * @Description
 */
@RestController
@RequestMapping("/inner")
public class QuestionInnerController implements QuestionFeignClient {

    @Resource
    private QuestionService questionService;

    @Resource
    private QuestionSubmitService questionSubmitService;

    @Override
    @GetMapping("/id")
    public Question getQuestionById(@RequestParam("questionId") long questionId){
        return questionService.getById(questionId);
    }

    @Override
    @PutMapping("/id")
    public boolean updateById(QuestionSubmit questionSubmit){
        return questionSubmitService.updateById(questionSubmit);
    }

    @Override
    @GetMapping("/submit/id")
    public QuestionSubmit getQuestionSubmitById(@RequestParam("questionSubmitId") long questionSubmitId){
        return questionSubmitService.getById(questionSubmitId);
    }
}
